package com.hfut.wxy.common.parent;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 所有表的根类
 */
@Getter
@Setter
@DynamicInsert
@DynamicUpdate
@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
public abstract class WxyBase extends WxyId implements Serializable {
    @CreatedDate
    @Column(nullable = false,columnDefinition = " datetime comment '创建时间'",updatable = false)
    @ApiModelProperty(example = "2020-01-01 00:00:00")
    protected Date createTime;
    @LastModifiedDate
    @Column(nullable = false,columnDefinition = " datetime comment '更新时间'")
    @ApiModelProperty(example = "2020-01-01 00:00:00")
    protected Date updateTime;
//    @CreatedBy
//    @Column(nullable = false,columnDefinition = " bit(1) default b'0' comment '删除标记'")
//    protected Boolean isDelete;

}
